import request from '@/utils/request'

const api_name = '/edu/chapter'

export default {

    // 根据课程ID获取所有数据
    nestedListChapter(courseId) {
        return request({
            url: `${api_name}/nested-list/${courseId}`,
            method: 'get'
        })
    },

    addChapter(chapter) {
        return request({
            url: `${api_name}`,
            method: 'post',
            data: chapter
        })
    },

    // 修改章节
    updateChapterById(chapter) {
        return request({
            url: `${api_name}`,
            method: 'put',
            data: chapter
        })
    },

    // 根据章节id，获取章节信息
    getChapterById(chapterId) {
        return request({
            url: `${api_name}/${chapterId}`,
            method: 'get'
        })
    },
    delChapterById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    },

}